//1、编写 router/index.js文件
import { createMemoryHistory, createRouter } from 'vue-router'

import Book from "@/components/Book.vue";
import Login from "@/components/Login.vue";
import Register from "@/components/Register.vue";
import Cart from "@/components/Cart.vue";
import Settlement from "@/components/Settlement.vue";
import Order from "@/components/Order.vue";
import Center from "@/components/Center.vue";

//2、配置路由表信息
const routes = [
    {
        path: '/',   //根目录访问地址
        name: 'book',
        component: Book
    }, {
        path: '/login',  //登录
        name: 'login',
        component: Login
    },{
        path: '/register',  //注册
        name: 'register',
        component: Register
    },
    {
        path: '/cart',  //注册
        name: 'cart',
        component: Cart
    },{
        path: '/settlement',
        name: 'settlement',
        component: Settlement  //结算页面
    }, {
        path: '/order',
        name: 'order',
        component: Order  //结算页面
    },
    {
        path: '/center',
        name: 'center',
        component: Center  //结算页面
    }
]

//创建路由器
const router = createRouter({
    history: createMemoryHistory(),
    routes,
})
export { router }